/*!
    Copyright (C) 1991-2013 johnxguo GX.
    This file is a part of the "Heaven Engine".
*/

#ifndef __GEO_UTIL_H_INCLUDED__
#define __GEO_UTIL_H_INCLUDED__

#include "vector2.h"
#include "vector3.h"
#include "line2.h"
#include "line3.h"
#include "plane.h"
#include "box2.h"
#include "box3.h"
#include "quat.h"
#include "triangle3.h"

namespace hea
{
namespace geo
{

template<class T>
vector3<T> Get3planeCrossPoint(const plane<T>& plane1, const plane<T>& plane2, const plane<T>& plane3)
{
    vector3<T> vec(false);
    line3<T> line;
    vec.valid = line.set_2plane(plane1, plane2) && (line.intersect(plane3, vec) == line3_INTERSECT);
    return vec;
}

}//! end namespace geo
}//! end namespace hea

#endif